Read in the data

sf_trees <- read.csv(here("data", "sf_trees", "sf_trees.csv"))

use tidyr:: separate() to separate one column into multiple (in this case, separate common and scientific name) and use tidyr :: unite() to bring them back together

sf_tress_sep <- sf_trees %>% separate(species, into = c('spp_scientific', 'spp_common'), sep = " :: ")

sf_trees_unite <- sf_trees %>% 
  unite("id_status", tree_id:species, sep = '_NEW_')

Make some actual maps!

blackwood_acacia_sf <- blackwood_acacia %>% 
  drop_na(longitude, latitude) %>% 
  st_as_sf(coords = c('longitude', 'latitude'))

# now you have coordinates as points and can plot them using simple features tool

st_crs(blackwood_acacia_sf) <- 4326 #basically a coordinate reference system, basic latitude and longitude

ggplot(data = blackwood_acacia_sf) + geom_sf(color = 'darkgreen') + theme_minimal()

### Read in SF streets data (sf in this case at the end stands for simple features)

sf_map_sf <- read_sf(here('data', 'sf_map', 'tl_2017_06075_roads.shp')) %>% 
  st_transform(4326) 

# st_crs(sf_map_sf) see what coordinate system you are working with and itf you have to change it
ggplot() + 
  geom_sf(data = sf_map_sf, size = 0.1, color = 'darkgrey') +
  geom_sf(data = blackwood_acacia_sf, color = 'darkgreen', size = 0.5) + theme_void() +
  labs(title = 'Blackwood acacias in San Francisco')

Interactive Map

tmap_mode('view')
## tmap mode set to interactive viewing
tm_shape(blackwood_acacia_sf) + tm_dots()